<?php

/**
 * DatacenterController
 * 
 * @package Sgit 
 * @author Juan Manuel Martinez Carrillo
 * @copyright Juan Manuel Martinez Carrillo
 * @version 2012
 * @access public
 */

class ContactosController extends Sgit_Controller_Action
{

    protected $_main_model = 'Contactos';
    protected $_main_form = 'Contactos';


    public function indexAction()
    {
  
        $filtros = new Sgit_Form_Filtros();
        
        $dc = new Sgit_Form_Element_Select_Datacenter('id_zona');
        
        $empresa = new Zend_Form_Element_Text('empresa');
        $empresa->setLabel('Empresa');
        $cargo = new Zend_Form_Element_Text('cargo');
        $cargo->setLabel('Cargo');
        
        $filtros->addFormSelect($dc);
        $filtros->addFormSelect($empresa);
        $filtros->addFormSelect($cargo);
        
        $values = $this->_getFiltrosValues($filtros);
        $filtros->addPdf();
        $filtros->addExcel();
        $filtros->myRender();
        
        
        $this->view->rows=$this->_model->default->getContactos($values);
        
        
        $this->_export($this->view->rows);
        
        $xml = $this->_getXml($this->_actionName);
        $this->view->columnas = $xml['columnas'];
        
        
    }

    public function editarAction()
    {
        $this->_editar();
    }


    public function insertarAction()
    {
        $this->_insertar();
    }

    public function borrarAction()
    {
        $this->_borrar();
    }


    protected function _prepareValuesToTr($row)
    {
       
        $row['zona']=Sgit_Cache::single()->model('Datacenter')->getKey($row['id_zona']);
        return $row;
    }


}
